package gui.batches;

import core.Container;
import core.Item;
import core.ItemFacade;
import core.exception.ModelException;

public class RemoveItemCommand implements Command {
	private Item _item;
	private Container _container;
	
	/**
	 * Construct a remove item command
	 * @param i The item to be removed
	 */
	public RemoveItemCommand(Item i){
		_item = i;
		_container = i.getContainer();
	}

	@Override
	public void execute() throws ModelException{
		ItemFacade.instance().removeItem(_item);

	}

	@Override
	public void undo() throws ModelException {
		ItemFacade.instance().unRemoveItem(_item, _container);
	}

}
